_EXAMPLE_RE = re.compile('\n # Source consists of a PS1 line followed by zero or more PS2 lines.\n (?P<source>\n (?:^(?P<indent> [ ]*) >>> .*) # PS1 line\n (?:\\n [ ]* \\.\\.\\. .*)*) # PS2 lines\n \\n?\n # Want consists of any non-blank lines that do not start with PS1.\n (?P<want> (?:(?![ ]*$) # Not a blank line\n (?![ ]*>>>) # Not a line starting with PS1\n .*$\\n? # But any other line\n )*)\n ', re.MULTILINE | re.VERBOSE)
_EXCEPTION_RE = re.compile("\n # Grab the traceback header. Different versions of Python have\n # said different things on the first traceback line.\n ^(?P<hdr> Traceback\\ \\(\n (?: most\\ recent\\ call\\ last\n | innermost\\ last\n ) \\) :\n )\n \\s* $ # toss trailing whitespace on the header.\n (?P<stack> .*?) # don't blink: absorb stuff until...\n ^ (?P<msg> \\w+ .*) # a line *starts* with alphanum.\n ", re.VERBOSE | re.MULTILINE | re.DOTALL)
'string': '\n Example of a string object, searched as-is.\n >>> x = 1; y = 2\n >>> x + y, x * y\n (3, 2)\n ',
'bool-int equivalence': '\n In 2.2, boolean expressions displayed\n 0 or 1. By default, we still accept\n them. This can be disabled by passing\n DONT_ACCEPT_TRUE_FOR_1 to the new\n optionflags argument.\n >>> 4 == 4\n 1\n >>> 4 == 4\n True\n >>> 4 > 4\n 0\n >>> 4 > 4\n False\n ',
'blank lines': "\n Blank lines can be marked with <BLANKLINE>:\n >>> print 'foo\\n\\nbar\\n'\n foo\n <BLANKLINE>\n bar\n <BLANKLINE>\n ",
'ellipsis': "\n If the ellipsis flag is used, then '...' can be used to\n elide substrings in the desired output:\n >>> print range(1000) #doctest: +ELLIPSIS\n [0, 1, 2, ..., 999]\n ",
'whitespace normalization': '\n If the whitespace normalization flag is used, then\n differences in whitespace are ignored.\n >>> print range(30) #doctest: +NORMALIZE_WHITESPACE\n [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,\n 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,\n 27, 28, 29]\n ' }